package com.yanqu.road.server.manger.activity.summergames;

import com.yanqu.road.entity.config.goods.GoodsInfo;
import com.yanqu.road.entity.player.UserBagItem;
import com.yanqu.road.server.manger.config.GoodsMgr;

import java.util.Comparator;

public class SummerGamesMedalsSort implements Comparator<UserBagItem> {

    @Override
    public int compare(UserBagItem o1, UserBagItem o2) {
        GoodsInfo goodsInfo1 = GoodsMgr.getGoodsById(o1.getGoodsId());
        GoodsInfo goodsInfo2 = GoodsMgr.getGoodsById(o2.getGoodsId());
        //金、银、铜
        //5、4、3
        if(goodsInfo1.getQuality() != goodsInfo2.getQuality()){
            return Integer.compare(goodsInfo2.getQuality(), goodsInfo1.getQuality());
        }
        return Long.compare(o2.getNum(), o1.getNum());
    }
}
